<?php

require_once('C:/Apache/php/ext/jpgraph/src/jpgraph.php');
require_once('C:/Apache/php/ext/jpgraph/src/jpgraph_scatter.php');

$cookie = $_COOKIE["genEvolution"];
// use "true" parameter to decode as array
$cookieValue = json_decode($cookie, true);
$gens = count($cookieValue);
$genZero = $cookieValue["generation_0"];
$datay = array_keys($genZero);
$datax = array();
$inds = count($genZero);
$i = 0;
foreach($datay as $key){
	$val = $genZero[$key];
	$datax[$i] = $val;
	$i++;
}
//echo count($datax);
//echo "</br>";
//echo count($datay);
//echo "</br>";

//$datax = array(3.5,3.7,3,4,6.2,6,3.5,8,14,8,11.1,13.7);
//$datay = array(20,22,12,13,17,20,16,19,30,31,40,43);

//print_r ($datax);
//echo "</br>";
//print_r ($datay);
 
$graph = new Graph(300,200);
$graph->SetScale("linlin");
 
$graph->img->SetMargin(40,40,40,40);        
$graph->SetShadow();
 
$graph->title->Set("A simple scatter plot");
$graph->title->SetFont(FF_FONT1,FS_BOLD);
 
$sp1 = new ScatterPlot($datay,$datax);
 
$graph->Add($sp1);
$graph->Stroke();
 
?>
